package net.bwie.realtime.service.jtprealtimeservice.mapper;

import net.bwie.realtime.service.jtprealtimeservice.been.TrafficUvBeen;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TrafficMapper {

    @Select("SELECT\n" +
            "    channel AS name,\n" +
            "    sum(uv_count) AS value\n" +
            "FROM jtp_log_report.dws_traffic_page_view_window_report\n" +
            "WHERE toDate(window_start_time) = #{date}\n" +
            "GROUP BY channel")
    List<TrafficUvBeen> getUVCount(@Param("date") String date);

    @Select("SELECT\n" +
            "    channel AS name,\n" +
            "    sum(pv_count) AS value\n" +
            "FROM jtp_log_report.dws_traffic_page_view_window_report\n" +
            "WHERE toDate(window_start_time) = #{date}\n" +
            "GROUP BY channel")
    List<TrafficUvBeen> getPVCount(@Param("date") String date);
}